<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>CMS</title>
<link href="__CSS__/common.css" rel="stylesheet"/>
<link href="__CSS__/right.css" rel="stylesheet"/>
<link rel="stylesheet" href="__INC__/form/css/zebra_form.css" type="text/css">
<link rel="stylesheet" href="__CSS__/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="__JS__/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="__JS__/jquery.ztree.all-3.3.min.js"></script>
<script type="text/javascript" language="javascript" src="__JS__/common.js"></script>
<script type="text/javascript" language="javascript">
    $(document).ready(function () {
        $(".table_list tr").mouseover(function () {
            $(this).addClass("one");
        })
        $(".table_list tr").mouseout(function () {
            $(this).removeClass("one");
        })
    });
</script>
<style type="text/css">
    .one {
        background: #fcfcfc;
    }
</style>
<script>

    //展开节点
    function expandNode(e) {
        var objid = e.data.objid;
        var zTree = $.fn.zTree.getZTreeObj(objid),
                type = e.data.type,
                nodes = zTree.getSelectedNodes();
        if (type.indexOf("All") < 0 && nodes.length == 0) {
            alert("请先选择一个父节点");
        }

        if (type == "expandAll") {
            zTree.expandAll(true);
        } else if (type == "collapseAll") {
            zTree.expandAll(false);
        } else {
            var callbackFlag = $("#callbackTrigger").attr("checked");
            for (var i = 0, l = nodes.length; i < l; i++) {
                zTree.setting.view.fontCss = {};
                if (type == "expand") {
                    zTree.expandNode(nodes[i], true, null, null, callbackFlag);
                } else if (type == "collapse") {
                    zTree.expandNode(nodes[i], false, null, null, callbackFlag);
                } else if (type == "toggle") {
                    zTree.expandNode(nodes[i], null, null, null, callbackFlag);
                } else if (type == "expandSon") {
                    zTree.expandNode(nodes[i], true, true, null, callbackFlag);
                } else if (type == "collapseSon") {
                    zTree.expandNode(nodes[i], false, true, null, callbackFlag);
                }
            }
        }
    }
    $(function () {
        var setting = {
            data: {
                simpleData: {enable: true}
            }
        };
        $.post("{:U('ajax/arr2ztree')}", {}, function (data) {
            //	alert(data[0]);
            if (data !== null) {
                var arctypetreeObj = $.fn.zTree.init($("#arctypetree"), setting, data);
                arctypetreeObj.expandAll(true);
            }
        }, 'json');
    });
</script>
</head>
<body>
<!--右侧区域 begin-->
<div class="right">
    <!--当前位置 begin-->
    <include file='common:crumbs'/>
    <!--当前位置 end-->
    <!--主体区域 begin-->
    <div class="container">
        <div class="alert_div">
            <h4 class="alert_info"><span class="welcome">{$welcome}</span>您现在的位置是：{$current} </h4>
            <h4 class="alert_what" style="display:none;"></h4>
        </div>
        <!--样式一 begin-->
        <div class="stats">
            <div class="lm_title">
                <div class="lm_title_l"><em>操作面板</em></div>
            </div>
            <div class="lm_content">
                <div id="panel">
                    <div class="infos_left">
                        <table class="Zebra_Form">
                            <tr class="row">
                                <td><label>快捷操作:</label></td>
                                <td><input type="button" class="button" onclick="refresh()" value="刷新"/></td>
                                <td><input type="button" class="button" onclick="openpanel('create')" value="生成"/></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
            <div class="lm_bottom">
                <div class="lm_bottom_l"><em></em></div>
            </div>
        </div>
        <!--样式一 end-->
        <!--样式三 begin-->
        <div class="stats">
            <div class="lm_title">
                <div class="lm_title_l"><em>{$current}</em></div>
            </div>
            <div class="lm_content" style="height:auto;">
                <ul id="arctypetree" class="ztree"></ul>
                <span style='font-size:10px; font-weight:normal; margin-left:40px; color:#FF00AE;'>{$error}</span>
            </div>
            <div class="lm_bottom">
                <div class="lm_bottom_l"><em></em></div>
            </div>
        </div>
        <!--样式三 end-->
    </div>
    <!--主体区域 end-->
</div>
<!--右侧区域  end-->
<!--弹出层二begin-->
<div class="popupPanel">
    <div class="stats">
        <div class="lm_title">
            <div class="lm_title_l"><em id="panelTitle">做什么？</em></div>
        </div>
        <div class="lm_content">
            <table class="Zebra_Form" style="width:100%;">
                <tr class="row movePanel" style="display:none;">
                    <input type="hidden" id="panelaction" value=""/>
                    <td width="80"><label>目的栏目：</label></td>
                    <td colspan="2" id="checked_items">
                        <select name="totid" id="movetoselect">
                            {$selection_html}
                        </select>
                    </td>
                </tr>
                <tr class="row">
                    <td></td>
                    <td><input type="button" onclick="panelDo()" class="button" value="确定"/></td>
                    <td><input type="button" class="button" onclick="panelClose()" value="取消"/></td>
                </tr>
            </table>
        </div>
        <div class="lm_bottom">
            <div class="lm_bottom_l"><em></em></div>
        </div>
    </div>
</div>
<!--弹出层二end-->
</body>
<script>
    function refresh() {
        location.href = location.href;
    }

    //开启panel窗口
    function openpanel(act, item) {
        //初始化关闭所有附加panel
        $(".movePanel").hide();
        if (act == 'create') {
            $(".movePanel").show();
            $("#panelTitle").text("你确定要生成这些栏目到指定栏目中？");
            $("#panelaction").val("create");
            var obj = $('.popupPanel');
            jl_fadeIn(obj);
        } else {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }
    }

    //关闭panel窗口
    function panelClose() {
        var obj = $('.popupPanel');
        jl_fadeOut(obj);
    }


    //panel执行操作
    function panelDo() {
        var act = $("#panelaction").val();
        if (act == '') {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }
        if (act == 'create') {
            jl_fadeOut($('.popupPanel'));
            var totid = $("#movetoselect").val();
            $.post("__GROUP__/ajax/createArctype", {totid: totid}, function (data) {

                if (data == -1) {
                    jl_notify(2, "呜呜，批量生成栏目失败！");
                } else if (data == 1) {
                    location.href = location.href;
                } else {
                    jl_notify(2, "呜呜，种种原因导致批量生成失败！");
                }
            });
        } else {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }
    }
</script>
</html>
